<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>驾校信息查看</title>
    <link href="../../layui/css/layui.css" rel="stylesheet">
    <link href="../../static/css/style.css" rel="stylesheet">
    <script src="../../static/js/jquery.min.js"></script>
    <script src="../../static/js/jquery.cookie.js"></script>
    <script src="../../layui/layui.js"></script>
    <script src="../../static/js/base.js"></script>
    <script src="../../static/js/ax.js"></script>
    <!--[if lt IE 9]>
    <script src="../../static/js/html5.js"></script>
    <script src="../../static/js/respond.js"></script>
    <![endif]-->

</head>
<body class="bg_w">

<div class="content-wrap">
    <div id="test1hide">
        <h3 class="title_li">驾校账号</h3>
        <div class="layui-row">
            <div class="layui-col-xs12">
                <table class="layui-hide" id="test1"></table>
            </div>
        </div>
    </div>

    <div id="test2hide">
        <h3 class="title_li">分校账号</h3>
        <div class="layui-row">
            <div class="layui-col-xs12">
                <table class="layui-hide" id="test2"></table>
            </div>
        </div>
    </div>

    <div id="test3hide">
        <h3 class="title_li">报名点账号</h3>
        <div class="layui-row">
            <div class="layui-col-xs12">
                <table class="layui-hide" id="test3"></table>
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-col-space10">
        <div class="layui-input-block">
            <button type="reset" class="layui-btn layui-btn-primary btn-left">关闭</button>
        </div>
    </div>


</div>


</body>

<script>
    var depCode;
    var type;
    window.onload = function () {
        depCode = decodeURI(getQueryString('depCode'));
        type = decodeURI(getQueryString('type'));
        if (type == 1 || type == 2) {
            showTable("#test1", depCode, type);
            showTable("#test2", depCode, 3);
            showTable("#test3", depCode, 4);
        }
        if (type == 3) {
            $("#test1hide").hide();
            showTable("#test2", depCode, 3);
            showTable("#test3", depCode, 4);
        }
        if (type == 4) {
            $("#test1hide").hide();
            $("#test2hide").hide();
            showTable("#test3", depCode, 4);
        }
    };

    function showTable(id, depCode, type) {
        layui.use('table', function () {
            var table = layui.table;
            ax.VTable({
                elem: id
                , url: backendWebUrl+'/api/school/user/getUserSchoolPage'
                , cellMinWidth: 80 //全局定义常规单元格的最小宽度，layui 2.2.1 新增
                , where: {
                    depCode: depCode,
                    type: type
                }
                , page: false
                , cols: [[
                    {field: '序列号', width: 80, title: '序列号', sort: true, type: 'numbers'},
                    {field: 'name', title: '用户姓名'},
                    {field: 'username', title: '用户账号'},
                    {
                        field: 'state', title: '账号状态', templet: function (d) {
                            if (d.state == -1) {
                                return '<span style="color: #007cff;">停用</span>';
                            } else if (d.state == 0) {
                                return '<span style="color: #007cff;">待激活</span>';
                            } else if (d.state == 1) {
                                return '<span style="color: #007cff;">启用</span>';
                            } else {
                                return "";
                            }
                        }
                    },
                    {field: 'depName', title: '驾校名称'},
                    {field: 'operatorName', title: '创建人'},
                    {field: 'created', title: '创建时间'}
                ]]
            });
        });
    }

</script>
</html>